package com.github.service.cms;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.cache.CacheManager;
import com.github.common.utils.StringUtils;
import com.github.dao.cms.UserDAO;
import com.github.module.cms.User;

/**
 * <p>User: Mu Yunlong
 * <p>Date: 2016年2月3日 上午9:30:07
 * <p>Version: 1.0
 */
@Service
public class UserService {

    @Autowired
    UserDAO userDAO;
    @Autowired
    CacheManager cm;

    public List<User> getUserList(User t00_user) {
        List<User> userList = userDAO.getT00_userList(t00_user);
        java.util.Map<String, String> sexMap = cm.get("T10003");
        for (User user : userList) {
            if (StringUtils.isNotEmpty(user.getSex())) {
                user.setSex(sexMap.get(user.getSex()));
            }
        }
        return userList;
    }

    public User getT00_userDisp(User t00_user) {
        return userDAO.getT00_userDisp(t00_user);
    }

    public int insertUser(User t00_user) {
        return userDAO.insertT00_user(t00_user);
    }

    public int updateUser(User t00_user) {
        return userDAO.updateT00_user(t00_user);
    }

    public int deleteT00_user(Long userid) {
        return userDAO.deleteT00_user(userid);
    }

}
